#ifndef THINK_THINK_CONSOLE_OUTPUT_H
#define THINK_THINK_CONSOLE_OUTPUT_H

static char* think_console_output =
	"\n"
	"// +----------------------------------------------------------------------\n"
	"// | ThinkPHP [ WE CAN DO IT JUST THINK ]\n"
	"// +----------------------------------------------------------------------\n"
	"// | Copyright (c) 2006~2015 http://thinkphp.cn All rights reserved.\n"
	"// +----------------------------------------------------------------------\n"
	"// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n"
	"// +----------------------------------------------------------------------\n"
	"// | Author: yunwuxin <448901948@qq.com>\n"
	"// +----------------------------------------------------------------------\n"
	"\n"
	"namespace think\\console;\n"
	"\n"
	"use Exception;\n"
	"use think\\console\\output\\Ask;\n"
	"use think\\console\\output\\Descriptor;\n"
	"use think\\console\\output\\driver\\Buffer;\n"
	"use think\\console\\output\\driver\\Console;\n"
	"use think\\console\\output\\driver\\Nothing;\n"
	"use think\\console\\output\\Question;\n"
	"use think\\console\\output\\question\\Choice;\n"
	"use think\\console\\output\\question\\Confirmation;\n"
	"\n"
	"/**\n"
	" * Class Output\n"
	" * @package think\\console\n"
	" *\n"
	" * @see     \\think\\console\\output\\driver\\Console::setDecorated\n"
	" * @method void setDecorated($decorated)\n"
	" *\n"
	" * @see     \\think\\console\\output\\driver\\Buffer::fetch\n"
	" * @method string fetch()\n"
	" *\n"
	" * @method void info($message)\n"
	" * @method void error($message)\n"
	" * @method void comment($message)\n"
	" * @method void warning($message)\n"
	" * @method void highlight($message)\n"
	" * @method void question($message)\n"
	" */\n"
	"class Output\n"
	"{\n"
	"    const VERBOSITY_QUIET        = 0;\n"
	"    const VERBOSITY_NORMAL       = 1;\n"
	"    const VERBOSITY_VERBOSE      = 2;\n"
	"    const VERBOSITY_VERY_VERBOSE = 3;\n"
	"    const VERBOSITY_DEBUG        = 4;\n"
	"\n"
	"    const OUTPUT_NORMAL = 0;\n"
	"    const OUTPUT_RAW    = 1;\n"
	"    const OUTPUT_PLAIN  = 2;\n"
	"\n"
	"    private $verbosity = self::VERBOSITY_NORMAL;\n"
	"\n"
	"    /** @var Buffer|Console|Nothing */\n"
	"    private $handle = null;\n"
	"\n"
	"    protected $styles = [\n"
	"        \'info\',\n"
	"        \'error\',\n"
	"        \'comment\',\n"
	"        \'question\',\n"
	"        \'highlight\',\n"
	"        \'warning\'\n"
	"    ];\n"
	"\n"
	"    public function __construct($driver = \'console\')\n"
	"    {\n"
	"        $class = \'\\\\think\\\\console\\\\output\\\\driver\\\\\' . ucwords($driver);\n"
	"\n"
	"        $this->handle = new $class($this);\n"
	"    }\n"
	"\n"
	"    public function ask(Input $input, $question, $default = null, $validator = null)\n"
	"    {\n"
	"        $question = new Question($question, $default);\n"
	"        $question->setValidator($validator);\n"
	"\n"
	"        return $this->askQuestion($input, $question);\n"
	"    }\n"
	"\n"
	"    public function askHidden(Input $input, $question, $validator = null)\n"
	"    {\n"
	"        $question = new Question($question);\n"
	"\n"
	"        $question->setHidden(true);\n"
	"        $question->setValidator($validator);\n"
	"\n"
	"        return $this->askQuestion($input, $question);\n"
	"    }\n"
	"\n"
	"    public function confirm(Input $input, $question, $default = true)\n"
	"    {\n"
	"        return $this->askQuestion($input, new Confirmation($question, $default));\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * {@inheritdoc}\n"
	"     */\n"
	"    public function choice(Input $input, $question, array $choices, $default = null)\n"
	"    {\n"
	"        if (null !== $default) {\n"
	"            $values  = array_flip($choices);\n"
	"            $default = $values[$default];\n"
	"        }\n"
	"\n"
	"        return $this->askQuestion($input, new Choice($question, $choices, $default));\n"
	"    }\n"
	"\n"
	"    protected function askQuestion(Input $input, Question $question)\n"
	"    {\n"
	"        $ask    = new Ask($input, $this, $question);\n"
	"        $answer = $ask->run();\n"
	"\n"
	"        if ($input->isInteractive()) {\n"
	"            $this->newLine();\n"
	"        }\n"
	"\n"
	"        return $answer;\n"
	"    }\n"
	"\n"
	"    protected function block($style, $message)\n"
	"    {\n"
	"        $this->writeln(\"<{$style}>{$message}</$style>\");\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 输出空行\n"
	"     * @param int $count\n"
	"     */\n"
	"    public function newLine($count = 1)\n"
	"    {\n"
	"        $this->write(str_repeat(PHP_EOL, $count));\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 输出信息并换行\n"
	"     * @param string $messages\n"
	"     * @param int    $type\n"
	"     */\n"
	"    public function writeln($messages, $type = self::OUTPUT_NORMAL)\n"
	"    {\n"
	"        $this->write($messages, true, $type);\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 输出信息\n"
	"     * @param string $messages\n"
	"     * @param bool   $newline\n"
	"     * @param int    $type\n"
	"     */\n"
	"    public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)\n"
	"    {\n"
	"        $this->handle->write($messages, $newline, $type);\n"
	"    }\n"
	"\n"
	"    public function renderException(\\Exception $e)\n"
	"    {\n"
	"        $this->handle->renderException($e);\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * {@inheritdoc}\n"
	"     */\n"
	"    public function setVerbosity($level)\n"
	"    {\n"
	"        $this->verbosity = (int) $level;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * {@inheritdoc}\n"
	"     */\n"
	"    public function getVerbosity()\n"
	"    {\n"
	"        return $this->verbosity;\n"
	"    }\n"
	"\n"
	"    public function isQuiet()\n"
	"    {\n"
	"        return self::VERBOSITY_QUIET === $this->verbosity;\n"
	"    }\n"
	"\n"
	"    public function isVerbose()\n"
	"    {\n"
	"        return self::VERBOSITY_VERBOSE <= $this->verbosity;\n"
	"    }\n"
	"\n"
	"    public function isVeryVerbose()\n"
	"    {\n"
	"        return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity;\n"
	"    }\n"
	"\n"
	"    public function isDebug()\n"
	"    {\n"
	"        return self::VERBOSITY_DEBUG <= $this->verbosity;\n"
	"    }\n"
	"\n"
	"    public function describe($object, array $options = [])\n"
	"    {\n"
	"        $descriptor = new Descriptor();\n"
	"        $options    = array_merge([\n"
	"            \'raw_text\' => false,\n"
	"        ], $options);\n"
	"\n"
	"        $descriptor->describe($this, $object, $options);\n"
	"    }\n"
	"\n"
	"    public function __call($method, $args)\n"
	"    {\n"
	"        if (in_array($method, $this->styles)) {\n"
	"            array_unshift($args, $method);\n"
	"            return call_user_func_array([$this, \'block\'], $args);\n"
	"        }\n"
	"\n"
	"        if ($this->handle && method_exists($this->handle, $method)) {\n"
	"            return call_user_func_array([$this->handle, $method], $args);\n"
	"        } else {\n"
	"            throw new Exception(\'method not exists:\' . __CLASS__ . \'->\' . $method);\n"
	"        }\n"
	"    }\n"
	"\n"
	"}\n"
	"\n"
;
#endif